import Vue from "vue";
import VueRouter from "vue-router";
import Collection from "../views/Collection";
import Company from "../views/Detail.vue";
import ExportDoc from "../views/ExportDoc.vue";
import Search from "../views/Filter.vue";
import CompanyDetail from "../views/Final.vue";
import Home from "../views/Home.vue";
import Buildings from "../views/List.vue";
import Login from "../views/Login.vue";
import Profile from "../views/My.vue";
import OtherList from "../views/OtherList";
import { registerAuthGuard } from "./guard";

Vue.use(VueRouter);

const routes = [
  { path: "/login", name: "Login", meta: { auth: false }, component: Login },
  {
    path: "/",
    name: "CompanyIndex",
    component: Home
  },
  {
    path: "/other-companies",
    name: "OtherCompanyIndex",
    component: OtherList
  },
  {
    path: "/areas/:aid/buildings/:id",
    name: "Buildings",
    component: Buildings
  },
  {
    path: "/search",
    name: "Search",
    component: Search
  },
  {
    path: "/companies/:id",
    name: "Company",
    component: Company
  },
  {
    path: "/companies/:id/detail/:name",
    name: "CompanyDetail",
    component: CompanyDetail
  },
  {
    path: "/export",
    name: "ExportDoc",
    component: ExportDoc
  },
  {
    path: "/profile",
    name: "Profile",
    component: Profile
  },
  {
    path: "/collection",
    name: "Collection",
    component: Collection
  }
];

const router = new VueRouter({
  routes
});

registerAuthGuard(router);

export default router;
